<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="p" uri="/WEB-INF/tld/page.tld" %>
<table class="table responsive-table" id="sorting-example1">
	<thead>
		<tr>
			<th scope="col">提问人</th>
			<th scope="col">标题</th>
			<th scope="col">状态</th>
			<th scope="col">创建时间</th>
			<!-- <th scope="col">回复人</th>
			<th scope="col">回复时间</th> -->
			<th scope="col">操作</th>
		</tr>
	</thead>
	
	<tbody>
		<c:forEach items="${askPage.list }" var="ask">
		<tr>
			<td>${ask.student_name }</td>
			<td>
				${ask.title }
			</td>
			<td>${ask.status_display }</td>
			<td>${ask.create_time }</td>
			<%-- <td>${ask.expert_name }</td>
			<td>${ask.reply_time }</td> --%>
			<td class="low-padding">
				<span class="button-group compact">
					<c:choose>
						<c:when test="${sessionScope.currentUser.type eq 2 and ask.status eq 0 }">
							<a href="javascript:;" class="button" onclick='viewAsk("${ask.id}")'>查看</a>
							<a href="javascript:;" class="button" onclick='askDialog("${ask.id}")'>修改</a>
							<a href="javascript:;" class="button" onclick='deleteAsk("${ask.id}")'>删除</a>
						</c:when>
						<c:when test="${sessionScope.currentUser.type eq 2 and ask.status eq 1 }">
							<a href="javascript:;" class="button" onclick='viewAsk("${ask.id}")'>查看</a>
							<a href="javascript:;" class="button" onclick='deleteAsk("${ask.id}")'>删除</a>
						</c:when>
						<c:when test="${sessionScope.currentUser.type ne 2 and ask.status eq 0 }">
							<a href="javascript:;" class="button" onclick='replyDialog("${ask.id}")'>回复</a>
						</c:when>
						<c:when test="${sessionScope.currentUser.type ne 2 and ask.status eq 1 }">
							<c:choose>
								<c:when test="${ask.can_reply eq 1 }">
									<a href="javascript:;" class="button" onclick='replyDialog("${ask.id}")'>回复</a>
								</c:when>
								<c:when test="${ask.can_reply eq 0 }">
									<a href="javascript:;" class="button" onclick='viewAsk("${ask.id}")'>查看</a>
								</c:when>
							</c:choose>
						</c:when>
					</c:choose>
				</span>
			</td>
		</tr>
		</c:forEach>
	</tbody>
</table>
<div class="dataTables_footer">
	<div class="dataTables_info" id="sorting-advanced_info">
		第${askPage.pageNumber }/${askPage.totalPage }页,共${askPage.totalRow }条记录
</div>
<p:page totalRow="${askPage.totalRow }" pageNumber="${askPage.pageNumber }" 
	totalPage="${askPage.totalPage }"/>
</div>
